<?php

Zend_Loader::loadClass("Application_Page");
Zend_Loader::loadClass("Application_Form_Preprocessor");
Zend_Loader::loadClass("Application_Menu_Preprocessor");
Zend_Loader::loadClass("Application_Navigation_Preprocessor");

class Application_Page_Preprocessor extends Application_Page
{
	private $_leftCol;
	private $_rightCol;

	protected function _init()
	{
		parent::_init();
		Zend_Layout::getMvcInstance()->setLayout('preprocessor');
		$this->addJavascript("/lib/plugins/jquery.uniform.custom.js");
		$this->addJavascript("/lib/plugins/jquery.md5.js");
	}

	public function run()
	{
		// 1. Costruzione del menu di navigazione
		//    Gestione del nodo attivo
		// 2. Costruzione del form
		// 3. ...

		$headNav = new Application_Navigation_Preprocessor();
		$prepForm = new Application_Form_Preprocessor();
		$menuNav = new Application_Menu_Preprocessor();

		$menuNav->run();
		$prepForm->run();

		Zend_Layout::getMvcInstance()->section = "Preprocessor";
		Zend_Layout::getMvcInstance()->topRow = $headNav->render();
		Zend_Layout::getMvcInstance()->sidebar = $menuNav->render();
		Zend_Layout::getMvcInstance()->rightCol = $prepForm->render();
	}
}
